home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 2: CDPD 1
/
Almathera Ten on Ten - Disc 2: CDPD 1.iso
/
pd
/
576-600
/
592
/
ezasm
/
mk.s
< prev
next >
Wrap
Text File
|
1995-03-15
|
3KB
|
234 lines
* Make for EZAsm, A68k, Blink
* Test for success by Lock() / Examine() on produced file
* Support for with/without include path:
* Mk -iPathToIncludes filenm
* Mk filenm
* Support for .mak file
* Mk filenm
* ( Minutes combined with Tics to prevent "wrap around" problems )
LONG CLIArg Nm _DosBase OutHandle
LONG Buf Tbuf
LONG FIB Cdays Flock Comb
LONG Fhandle Rbuf PtrSave
BYTE MkSw
CLIArg = a0
-1(a0,d0.w) = 0 ;0 terminate CLI argument
_DosBase = OpenLibrary( "dos.library" 0 )
beq Quit
FIB = AllocMem( 300 $10001 ) ;FIB buffer
beq Quit
Tbuf = AllocMem( 12 $10001 ) ;DateStamp() buffer
beq Quit
Buf = AllocMem( 127 $10001 ) ;Execute() buffer
beq Quit
PrintInit( )
beq Quit
OutHandle = Output( )
* Get current time
a0 = DateStamp( Tbuf )
Cdays = (a0) ;save Days
d0 = 4(a0) ;D0 = Minutes
swap d0 ;Minutes to upper 2 bytes
d0 |= 8(a0) ;combine Minutes with Tics
Comb = d0 ;save for compare
* Adjust CLI args for an include path..
strrchr( CLIArg $20 )
d0 != 0 {
d0 ++
Nm = d0
} else {
Nm = CLIArg
strcpy( Buf Nm )
strcat( Buf ".mak" )
Fhandle = Open( Buf 1005 )
beq Cont
MkSw = 1
Rbuf = AllocMem( 1000 $10001 )
beq Quit
PtrSave = Rbuf
Read( Fhandle Rbuf 1000 )
bmi Quit
}
Cont
Print( "--------------------\n" * )
MkSw = 1 {
bsr LoadNext
} else {
strcpy( Buf "ezasm " )
strcat( Buf Nm )
strcat( Buf ".s\n" )
}
Execute( Buf 0 OutHandle ) ; "ezasm [file].s\n"
Print( "--------------------\n" * )
strcpy( Buf Nm ) ;get name to Lock()
strcat( Buf ".asm" )
bsr Check
MkSw = 1 {
bsr LoadNext
} else {
strcpy( Buf "a68k " )
strcat( Buf CLIArg )
strcat( Buf ".asm\n" )
}
Execute( Buf 0 OutHandle ) ; "a68k [file].asm\n"
Print( "--------------------\n" * )
strcpy( Buf Nm ) ;get name to Lock()
strcat( Buf ".o" )
bsr Check
MkSw = 1 {
bsr LoadNext
} else {
strcpy( Buf "blink FROM " )
strcat( Buf Nm )
strcat( Buf ".o LIBRARY ez.lib TO " )
strcat( Buf Nm )
strcat( Buf "\n" );
}
* Blink FROM [file].o LIBRARY ez.lib TO [file]
Execute( Buf 0 OutHandle )
jmp Quit
Check
Flock = Lock( Buf -2 )
beq Quit
* It's here, but is it more recent than Current values?
Examine( Flock FIB )
beq Quit
a0 = FIB
d0 = 132(a0) ;D0 = Days
d0 < Cdays Quit
d0 = 136(a0) ;D0 = Minutes
swap d0
d0 |= 140(a0) ;combine with Tics
d0 < Comb Quit
UnLock( Flock )
Flock = 0
rts
* Locate next line to Execute(), and load into Buf..
LoadNext
a0 = PtrSave
Again
isalpha( * ) {
a0 = PtrSave
a1 = Buf
Nxt (a1)+ = (a0)+ b
-1(a1) != $0a Nxt
(a1) = 0 b
PtrSave = a0 ;( byte after $0a )
rts
}
a0 = PtrSave
Inc (a0)+ = $0a {
PtrSave = a0
jmp Again
}
jmp Inc
Quit
PrintClose( )
Fhandle != 0 {
Close( Fhandle )
}
Rbuf != 0 {
FreeMem( Rbuf 1000 )
}
Flock != 0 {
UnLock( Flock )
}
FIB != 0 {
FreeMem( FIB 300 )
}
Tbuf != 0 {
FreeMem( Tbuf 12 )
}
Buf != 0 {
FreeMem( Buf 127 )
}
_DosBase != 0 {
CloseLibrary( _DosBase )
}
END